<?php   

/** 
* Controller
* Контроллер 
* @author IT studio IRBIS-team 
* @copyright © 2009 IRBIS-team 
*/
/////////////////////////////////////////////////////////

/**
* Generation of page of an error at access out of system
* Генерация страницы ошибки при доступе вне системы
*/
    if(!defined('IRB_KEY'))
    {
       header("HTTP/1.1 404 Not Found");      
       exit(file_get_contents('../../404.html'));
    } 
//////////////////////////////////////////////////////////

 /** 
* Function of generation of a menu of pages
* Функция генерации меню страниц
* @param array
* @return string
*/ 
    function createMenu($links = array())
    {
        if(!empty($links[1]))
        {
            $menu = "<ul class=\"pages_menu\">\n";
            foreach($links as $num => $link)
                $menu .= "<li>
                          <a href=\"". href('id='. $link[0]) ."\">". $link[1] ."</a> 
                          </li>\n";
    
            return $menu ."</ul>\n";
         }    
    }   
////////////////////////////////////////////////////////////////
       
    if(file_exists(IRB_ROOT .'setup/menu.txt'))
       $links = unserialize(file_get_contents(IRB_ROOT .'setup/menu.txt'));
    else
       $links = array('', array('',''));
	   
	$GET['id'] = !empty($GET['id'])?$GET['id']:$links[1][0];   
    $page_content = '';	       
/** 
* Read page
* Читаем страницу 
*/ 	
	if(file_exists('./setup/'. $GET['id'] .'.txt'))
       $page_content = file_get_contents('./setup/'. $GET['id'] .'.txt');

   
     